<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title>凡客诚品 - 注册会员</title>
	<link rel="stylesheet" href="__STATIC__/Index/css/reg.css" />
	<script type="text/javascript" src="__STATIC__/Index/js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript">
		$(function(){
			
			var validate = {
				username : false,
				password : false,
				password1 : false,
			};
			
			$('input[name=username]').blur(function(){
				var username = $(this).val().trim();
				if (username == ''){
					$('#userNameError').addClass('show');
					$('#userNameError').html('用户名不能为空');
					validate.username = false;
				}else{	
					$('#userNameError').removeClass('show');
					$('#userNameError').html('');
					// 异步检测用户是否存在
					$.ajax({
						type:"post",
						url:"{|U:'Member/ajaxCheckUser'}",
						data: { "username": username },
						dataType: 'json',
						success:function(phpData){
							var isUserExist = parseInt(phpData);
							if (isUserExist){
								$('#userNameError').addClass('show');
								$('#userNameError').html('该户名已存在');
								validate.username = false;
							}else{
								$('#userNameError').removeClass('show').html();
								validate.username = true;
							}
						}
					});
				}
			})
			
			$('input[name=password]').blur(function(){
				var password = $(this).val().trim();
				if (password == ''){
					$('#userPasswordError').addClass('show');
					$('#userPasswordError').html('密码不能为空');
					validate.password = false;
				}else if(password.length < 6){	
					$('#userPasswordError').addClass('show');
					$('#userPasswordError').html('密码不能小于6位');
					validate.password = false;					
				}else{
					$('#userPasswordError').removeClass('show');
					$('#userPasswordError').html('');
					validate.password = true;
				}
			})
			
			$('input[name=password1]').blur(function(){
				var password = $('input[name=password]').val();
				var password1 = $(this).val().trim();
				if (password1 != password){
					$('#userPassword1Error').addClass('show');
					$('#userPassword1Error').html('密码不一致');
					validate.password1 = false;
				}else{
					$('#userPassword1Error').removeClass('show');
					$('#userPassword1Error').html('');
					validate.password1 = true;		
				}			
			})
			
			$('#a_reg').click(function(){
				if (!validate.username || !validate.password || !validate.password1)
					return false;
					
				$('form').submit();
			})
		})
	</script>
</head>
<body>
	<div class="headWrap">
		<div id="Head">
			<a class="logo" href="index.php">	</a>
			<p><a href="" class="a_black">帮助</a></p>
		</div>
	</div>
	<div class="contentWrap">
		<form action="{|U:'Member/Reg'}" method="post">
			<div class="login">
				<div class="tag">
					<ul id="tags">
						<li class="on">VANCL用户</li>
						<li></li>
					</ul>
				</div>
				<div class="user_info">
					<div id="logError" class="tips">用户名错误</div>
					<p>
						<label for="">用户名:</label>
						<input type="text" placeholder="邮箱/手机号" name="username" />
					</p>
					<div id="userNameError" class="tips"></div>
					<p>
						<label for="">密&nbsp;&nbsp;码:</label>
						<input type="password" name="password" id="" />
					</p>
					<div id="userPasswordError" class="tips"></div>
					<p>
						<label for="">密码确认:</label>
						<input type="password" name="password1" id="" />
					</p>
					<div id="userPassword1Error" class="tips"></div>
					<div class="bt">
						<a id="a_reg" href="javascript:;" class="log">
							注&nbsp;&nbsp;册	
						</a>
						<a class="reg a_black" href="index.php?c=user">立即登录</a>
					</div>
				</div>
			</div>
		</form>
		<div class="ad">
			<img src="__STATIC__/Index/images/ad_login.jpg" alt="" />
		</div>
		<div style="clear:both"></div>		
	</div>
	<div class="bottom">
		<p>Copyright 2007 - 2014 vancl.com All Rights Reserved 京ICP证100557号 京公网安备11010102000579号 出版物经营许可证新出发京批字第直110138号</p>
	</div>
	
</body>
</html>